import $api from ".";
interface Customer {
  username: String; //用户名
  account: String; //账号
  password: String; //密码
  gender: String; //性别
  address: String; //地址
  phone: String; //手机号
  profile?: String; //头像
  [prop: string]: any;    //任意属性
}

// 添加客户
export const addCustomer = async (data: Customer) => {
  const res = await $api.post("customer/add", data);
  return res;
};

// 获取数据列表
export const getCustomerList = async (
  data: Partial<{ page: number; limit: number; a: string }>
) => {
  const res = await $api.post("customer/getList", data);
  return res;
};

//搜索列表数据
export const searchCustomerList = async (data: any) => {
  const res = await $api.post("/customer/getone", data);
  return res;
};

//单个删除客户
export const delterCustomer = async (id: number) => {
  const res = await $api.post("/customer/del", {id});
  return res;
};

//批量删除客户
export const delSelectCustomer =async(ids: number[]) =>{
  const res = await $api.post("/customer/delSelect",{ids})
  return res
}

//编辑客户信息
export const updateCustomer = async(data:Customer)=>{
  const res = await $api.post("/customer/update",data)
  return res
}